<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>
    function foo(name, age, height, address) {
      console.log('foo:', this)
      console.table({ name, age, height, address })
    }
    var obj = { name: "why" }

    // 调用foo时,总是绑定到obj对象上,不希望obj对象上有函数
    // foo.apply(obj)
    var bar = foo.bind(obj)
    bar()

    var bar = foo.bind(obj, 'kobe', 18, 1.88)
    bar("浙江省")

  </script>

</body>

</html>